//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class DataReference: IOfficeXmlSerializable

    {
        private string _ref;
        private string _name;
        private string _sheet;

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read("dataRef"))
            {
                _ref = c.GetOptionalString("ref");
                _name = c.GetOptionalString("name");
                _sheet = c.GetOptionalString("sheet");
                string rid = c.GetOptionalString(OfficeConstants.RelationshipNamespace + "id");
                if (rid != null)
                    throw new NotImplementedException();
            }

        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write("dataRef"))
            {
                c.SetOptionalString("ref", _ref);
                c.SetOptionalString("name", _name);
                c.SetOptionalString("sheet", _sheet);
            }
        }
    }
}
